home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / BT_FILE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  921 b   |  50 lines

  1. /*  bt_file.c - file I/O for BTREE module */
  2. #include   "stdio.h"
  3. #include   "cminor.h"
  4. #include   "btree.h"
  5. #include   "bt_macro.h"
  6.  
  7. #define    BOF_REL    0
  8. #define    WR_MODE    1
  9. #define    RW_MODE    2
  10.  
  11. extern    IX_DESC  *pci ;
  12.  
  13. int  creat_if(fn)            /* create a file */
  14.   char    fn[] ;
  15.   {
  16.      return( gcreat(fn,WR_MODE,BIN_MODE) ) ;
  17.   }
  18.  
  19. int  read_if(start,buf,nrd)
  20.   RECPOS   start ;
  21.   char    buf[] ;
  22.   int    nrd ;
  23.   {
  24.      lseek(pci->ixfile,start,BOF_REL) ;
  25.      return( read(pci->ixfile,buf,nrd) ) ;
  26.   }
  27.  
  28. int  write_if(start,buf,nwrt)
  29.   RECPOS   start ;
  30.   char    buf[] ;
  31.   int    nwrt ;
  32.   {
  33.      lseek(pci->ixfile,start,BOF_REL) ;
  34.      return( write(pci->ixfile,buf,nwrt) ) ;
  35.   }
  36.  
  37. int  close_if()             /* close an index file */
  38.   {
  39.      return( close(pci->ixfile) ) ;
  40.   }
  41.  
  42. int  open_if(fn)            /* open an index file */
  43.   char     fn[] ;
  44.   {
  45.      return( gopen(fn,RW_MODE,BIN_MODE) ) ;
  46.   }
  47.  
  48.  
  49.  
  50.